package com.test.gpa.test;

import org.springframework.stereotype.Component;

import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class Api  {
    public static void main(String[] args) {
        System.out.println();

    }

    public void output() {
        System.out.println("output");
    }


    public void intput() {
        System.out.println("intput");
    }

    public Map<String, ServiceInterface> apiMap(String get) {
        Map<String, ServiceInterface> map = new HashMap<>();
        map.put("aa", this::intput);
        map.put("bb", this::output);

        return map;
    }

    class MyCalendar {
        List<int[]> booked;

        public MyCalendar() {
            booked = new ArrayList<>();
        }

        public boolean book(int start, int end) {
            for (int[] a :
                    booked) {
                if (start < a[1] && end > a[0]) {
                    return false;
                }
            }
            booked.add(new int[]{start, end});
            return true;
        }
    }


}

interface App {
    default int sum(int[] array) {
        int a = 0;
        for (int i = 0; i < array.length; i++) {
            a += array[i];
        }
        return a;
    }
}